package com.wei.czz.common.enums.blog;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2021-10-04 17:09:00
 * className: BlogUserOperationDict 用户关联博客操作字典枚举类
 * version: 2.0
 * description:
 */
@Getter
@AllArgsConstructor
public enum BlogUserOperationEnum {

    /*
        用户关联博客表字段字典值
     */
    // 用户关联博客操作类型
    VIEW_OPT(0, "用户浏览博客"), LIKE_OPT(1, "用户点赞博客"),
    COLLECT_OPT(2, "用户收藏博客"), COMMENT_OPT(3, "用户评论博客");

    /**
     * 值
     */
    private final Integer value;

    /**
     * 名称
     */
    private final String desc;

    /**
     * 根据参数值获取用户操作博客枚举对象
     * @param value 参数
     * @return 用户操作博客枚举对象
     */
    public static BlogUserOperationEnum getOptType(Integer value) {
        for (BlogUserOperationEnum blogUserOperationEnum : values()) {
            if (blogUserOperationEnum.getValue().equals(value)) {
                return blogUserOperationEnum;
            }
        }
        return null;
    }
}
